package com.itheima.atomic;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

/*
compareAndSet()
 */
public class Demo02 {

    public static void main(String[] args) {
     /*   AtomicBoolean ac = new AtomicBoolean();
        System.out.println(ac);*/
      /*  AtomicBoolean ac2 = new AtomicBoolean(true);
        System.out.println(ac2);
*/
       /* boolean b1 = ac.compareAndSet(false, false);
        System.out.println(b1);
        System.out.println(ac.get());

        boolean b = ac.compareAndSet(true, true);
        System.out.println(b);
        System.out.println(ac);*/

        AtomicInteger ac = new AtomicInteger(10);
        System.out.println(ac.compareAndSet(10, 500));
        System.out.println(ac.get());
        System.out.println(ac.compareAndSet(800, 50000));
        System.out.println(ac.get());

    }
}
